<?php
error_reporting(E_ALL);
ini_set('display_errors','On');
$timezone = "Asia/Saigon";
if(function_exists('date_default_timezone_set'))
    date_default_timezone_set($timezone);
    
require_once '../../config/config.php';
require_once '../../plugin/Smarty/Smarty.class.php';
require_once WEB_MODEL_DIR . DIRECTORY_SEPARATOR . 'Util'          . DIRECTORY_SEPARATOR . 'SEO.php';
require_once WEB_MODEL_DIR . DIRECTORY_SEPARATOR . 'Util'          . DIRECTORY_SEPARATOR . 'Pager.php';
require_once WEB_MODEL_DIR . DIRECTORY_SEPARATOR . 'Util'          . DIRECTORY_SEPARATOR . 'Tool.php';
require_once WEB_MODEL_DIR . DIRECTORY_SEPARATOR . 'Context'       . DIRECTORY_SEPARATOR . 'BaseContext.php';
require_once WEB_MODEL_DIR . DIRECTORY_SEPARATOR . 'ServiceResult' . DIRECTORY_SEPARATOR . 'ServiceResult.php';
require_once WEB_MODEL_DIR . DIRECTORY_SEPARATOR . 'Service'       . DIRECTORY_SEPARATOR . 'GameService.php';

$context = new BaseContext();
$result = new ServiceResult();
$gameService = new GameService();

if($_POST['id'])
{
	$_POST['id']=$_POST['id'];
	$_POST['link']=$_POST['gameLink'];
	$_POST['type']=$_POST['gametype'];
	$_POST['file_type']=$_POST['filetype'];
	$_POST['device']=$_POST['device'];
	$_POST['device_id']=$_POST['deviceid'];
	$param = $_POST;
	if(isset($_POST['database']))
	{
		$data = $_POST['database'];
		if($data == 'tpg')
		{
			$gameService -> updateGameLinkAjaxTPG($context, $result, $param);
		}
		elseif ($data == 'cgmb')
		{
			$gameService -> updateGameLinkAjaxCGMB($context, $result, $param);
		}
		elseif ($data == 'mmbg')
		{
			$gameService -> updateGameLinkAjaxMMBG($context, $result, $param);
		}
		elseif ($data == 'nsgt')
		{
			$gameService -> updateGameLinkAjaxNSGT($context, $result, $param);
		}
		elseif ($data == 'mobile')
		{
			$gameService -> updateGameLinkAjaxMobile($context, $result, $param);
		}
	}
	else 
	{
		$gameService -> updateGameLinkAjaxTPG($context, $result, $param);
	}
}
	
	
?>